﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="WinnerCMS.WebUI.Admin.Member.MemberRole"
    CodeBehind="Member_Role.aspx.cs" %>


<!doctype html>
<html>
<head runat="server">
    <title>会员角色</title>
    <meta http-equiv="Pragma" content="No-cach" />
     <%: Styles.Render("~/Content/Bootstrap/css") %>
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    
    
    <script type="text/javascript">
        function SelectAll(me) {
            $("input[name='chkOperation']").each(function () {
                this.checked = me.checked;
            });
        }
      
    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <table width="100%" id="NavigationPath">
        <tr>
            <td><asp:Label ID="lblPath" runat="server"></asp:Label>
            </td>
        </tr>
    </table>
    <asp:GridView ID="GV_List" runat="server" AutoGenerateColumns="False" 
        OnRowDataBound="GV_List_RowDataBound" OnRowDeleting="GV_List_RowDeleting" DataKeyNames="ID" GridLines="None" CssClass="table table-bordered table-condensed table-hover">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID">
                <ItemStyle HorizontalAlign="Center" Width="40px" />
            </asp:BoundField>
            <asp:BoundField DataField="RoleName" HeaderText="角色">
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="Member_Role.aspx?Action=ReadOnly&amp;ID={0}"
                HeaderText="角色权力" Text="查看">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:BoundField DataField="Rank" HeaderText="权限等级标识">
                <HeaderStyle Width="100" />
                <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="Member_Role.aspx?Action=Edit&amp;ID={0}"
                HeaderText="修改" Text="修改">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:CommandField HeaderText="删除" ShowDeleteButton="True">
                <HeaderStyle Width="60" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:CommandField>
        </Columns>
        <HeaderStyle CssClass="HeaderStyle" />
    </asp:GridView>
    <asp:Panel ID="panel1" runat="server" Width="100%">
        <table id="Table1" border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr class="HeaderStyle">
                <td>
                    会 员 角 色
                </td>
            </tr>
            <tr>
                <td class="border">
                    　 　角色名称：<asp:TextBox ID="txtRoleName" runat="server"></asp:TextBox>
                    &nbsp;&nbsp;
                    <asp:Button ID="btnAdd" runat="server" Text="添加" OnClick="btnAdd_Click" Cssclass="btn btn-default" />
                    &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;
                    <br />
                    权限等级标识 ：<WinnerCMS:NumericTextBox ID="NtxtRank" runat="server" Width="60px">
                    &nbsp;
                    </WinnerCMS:NumericTextBox>
                    &nbsp;“权限等级标识”是标识会员角色的权力大小的，高级的角色可以浏览下、载低级别的权限文章、软件。
                    <br />
                    <hr />
                    <div class="control-group checkbox">
                    <asp:CheckBox ID="cbkALL" onclick="javascript:SelectAll(this);" runat="server" Text="全选所有权限："></asp:CheckBox>
                        </div>
                        
                 

                    <asp:DataList ID="DataList1" runat="server" BorderWidth="0" CellPadding="8" HorizontalAlign="Center"
                        RepeatColumns="2" RepeatDirection="Horizontal" Width="98%">
                        <ItemStyle BorderColor="ActiveBorder" Width="100%" />
                        <ItemTemplate>
                            <fieldset>
                                <legend>
                                    <%# Container.ItemIndex + 1 %>
                                    、<%# Eval("Name") %></legend>
                                <asp:DataList ID="Datalist2" runat="server" DataSource='<%# BindPower(Eval("RootID")) %>'
                                    RepeatColumns="4" RepeatDirection="Horizontal" Width="100%">
                                    <ItemStyle VerticalAlign="Top" />
                                    <ItemTemplate><div class="control-group checkbox">
                                        <input id="cbk<%# Eval("ID") %>" type="checkbox" name="chkOperation"  value='<%# Eval("ID") %>' title='<%# Eval("ID") %>' /><label for="cbk<%# Eval("ID") %>"><%# Eval("Name") %></label></div>
                                    </ItemTemplate>
                                </asp:DataList>
                            </fieldset>
                        </ItemTemplate>
                    </asp:DataList>

                     <script type="text/javascript">                         //复选框选择值
                         function CheckValues(strValue)
                         {
                             if (strValue == "") return;

                             $("input[name='chkOperation']").each(function ()
                             {
                                 if (strValue.indexOf("," + this.value + ",") >= 0)
                                 {
                                     this.checked = true;
                                 }

                             });
                         }
                         //初始化权限
                         CheckValues(",<%= strOperation %>,");
                    </script>

                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>
